package sg.edu.nus.iss.team8s.vmcs.state;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
 * 
 * @author LU ZHIXIAN
 *
 */
public class StateFactory {
	private ApplicationContext context;
	public StateFactory(){
		context = new ClassPathXmlApplicationContext("classpath:sg/edu/nus/iss/team8s/vmcs/state/state.xml");
	}

	public SystemState GetState(String stateName){
		SystemState state = (SystemState)context.getBean(stateName);
		if(state == null){
			throw new RuntimeException("Can not find the State for " + stateName);
		}
		return state;
		
	}
}
